Multicolumn Listbox Demo

Level: Any

by Alyce Watson [http://alycesrestaurant.com/]

Home

API Translator

Window Help

Communication

Slider Control

Desktop Shortcuts

Quick Visual Designer

Rules for Code

DATA and Arrays

Easy Polygon

Triangle Draw

Control a Sprite

Shell to DOS

Morse Code

Batch Files

Multicolumn Listbox

Newsletter help

Index


Listbox Style

The native Liberty BASIC listbox is a box containing a list of items. If there are more items than will fit in the visible area of the listbox, Windows adds a vertical scrollbar. When the user doubleclicks on an item, the program advances to the branch label specified in the LISTBOX command. If a "singleclickselect" command is sent to the listbox, then the program advances to the listbox handler when the user singleclicks an item in the list.

Multicolumn Listboxes

Multicolumn Listboxes are now possible in Liberty BASIC 4. They require the STYLEBITS command.

Stylebits

The modification of a listbox so that it displays items in multiple columns requires two added bit flags in the style argument of the STYLEBITS command. This is the first of the four arguments. The other three arguments can be 0. Not only does the style change require the _LBS_MULTICOLUMN style bit, but it also requires the addition of a horizontal scrollbar with the _WS_HSCROLL style bit. The two bits are put together with OR to be used as a single value in the STYLEBITS command:

_LBS_MULTICOLUMN or _WS_HSCROLL

The STYLEBITS command looks like this to create a multicolumn listbox:

stylebits #1.list, _LBS_MULTICOLUMN or _WS_HSCROLL,0,0,0

DEMO

nomainwin
WindowWidth=224:WindowHeight=240
dim a$(100)
for i = 1 to 100
     a$(i)="item ";i
next


listbox #1.list, a$(),[click],10,10,200,200
stylebits #1.list, _LBS_MULTICOLUMN or _WS_HSCROLL,0,0,0
open "Multicolumn Listbox" for window as #1
#1 "trapclose [quit]"
#1.list "font courier_new 8"
#1.list "singleclickselect"
wait


[quit] close #1:end
[click]
#1.list "selection? sel$"
notice "You chose ";sel$
wait




Home

API Translator

Window Help

Communication

Slider Control

Desktop Shortcuts

Quick Visual Designer

Rules for Code

DATA and Arrays

Easy Polygon

Triangle Draw

Control a Sprite

Shell to DOS

Morse Code

Batch Files

Multicolumn Listbox

Newsletter help

Index